/// @tags: DP
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

namespace BlueQuantum {

int const N = 1e2 + 5;

char s[N];
int n, numlen[N], f[N][N];

inline bool check(char *const s, int len, int cir) {
  for (int i = cir; i < len; ++i)
    if (s[i] != s[i % cir]) return false;
  return true;
}

inline int main() {
  cin >> s;
  n = strlen(s);
  for (int i = 1; i < 10; ++i) numlen[i] = 1;
  for (int i = 10; i < 100; ++i) numlen[i] = 2;
  numlen[100] = 3;
  memset(f, 0x3f, sizeof(f));
  for (int i = 0; i < n; ++i) f[i][i] = 1;
  for (int len = 2; len <= n; ++len) {
    for (int l = 0, r = l + len - 1; r < n; ++l, ++r) {
      for (int k = l; k < r; k++) f[l][r] = min(f[l][r], f[l][k] + f[k + 1][r]);
      for (int k = l; k < r; k++) {
        int cir = k - l + 1;
        if (len % cir != 0) continue;
        if (check(s + l, len, cir))
          f[l][r] = min(f[l][r], f[l][k] + 2 + numlen[len / cir]);
      }
    }
  }
  cout << f[0][n - 1];
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P4302 [SCOI2003] 字符串折叠.in", "r", stdin);
  freopen("P4302 [SCOI2003] 字符串折叠.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
